package kubayaxi.video.client.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import kubayaxi.video.client.service.IChannelService;
import kubayaxi.video.mybatis.auto.model.Channel;
import kubayaxi.video.mybatis.customize.dao.ChannelMeMapper;
import kubayaxi.video.mybatis.customize.model.channel.dto.ChannelVideoDTO;
import kubayaxi.video.mybatis.customize.model.channel.vo.ChannelVideoVO;
import kubayaxi.video.service.base.common.request.BaseRequest;
import kubayaxi.video.service.base.common.response.ResponseResult;
import kubayaxi.video.service.base.common.vo.CommonPageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/client/channel")
@Api(tags = "客户端【频道】")
public class ChannelController {
    @Resource
    private IChannelService channelService;

    @ApiOperation("获取全部频道")
    @PostMapping("/allChannel")
    public ResponseResult<List<Channel>> allChannel(){
        List<Channel> ans = channelService.allChannel();
        return ResponseResult.success(ans);
    }

    @ApiOperation("获取频道相关视频")
    @PostMapping("/channelVideo")
    public ResponseResult<CommonPageResult<ChannelVideoVO>> channelVideo(@RequestBody BaseRequest<ChannelVideoDTO> dto) {
        CommonPageResult<ChannelVideoVO> ans = channelService.channelVideo(dto);
        return ResponseResult.success(ans);
    }
}
